package com.bdbit.ChargingStation.dao.mapper;

import com.bdbit.ChargingStation.entity.OrderEntity;
import com.bdbit.ChargingStation.entity.StatisticsByDay;
import com.bdbit.ChargingStation.entity.StatisticsByMonth;
import com.bdbit.ChargingStation.entity.returnBean;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface OrderEntityMapper {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(OrderEntity record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(OrderEntity record);

    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    OrderEntity selectByPrimaryKey(Integer id);

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(OrderEntity record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(OrderEntity record);

    @Select("SELECT * FROM charging_order WHERE order_id = #{orderNo}")
    OrderEntity selectByOrderNo(@Param("orderNo") String orderNo);

    @Select("SELECT * FROM charging_order WHERE status = #{status}")
    List<OrderEntity> selectByStatus(int status);

    List<StatisticsByMonth> getOrderStatisticsByMonth(String eleCode,  String startDate,  String endDate);
    List<StatisticsByDay> getOrderStatisticsByDay(String eleCode, String Date);
}